import React, { forwardRef } from 'react';
import CustomIcon from './CustomIcon';
import styles from './styles.less';
import { getFlowType } from './utils';

// 流程图标
const FlowIcon = forwardRef(({ value, style, ...rest }, ref) => {
    const iconObj = getFlowType(value || 'leave') || {};
    return (
        <span ref={ref}>
            <CustomIcon
                type={iconObj.className}
                className={styles.flowIcon}
                isAntdIcon={false}
                style={{
                    cursor: 'pointer',
                    color: iconObj.color,
                    backgroundColor: iconObj.backgroundColor || '',
                    ...style
                }}
                {...rest}
            />
        </span>
    );
});

export default FlowIcon;
